<template>
  <div class="son">
    <p>我是子组件</p>
    <p>{{msg}}</p>
    <input type="text" v-model="value" >
    <button @click="btn">传值给父组件</button>
  </div>
</template>
<script>
export default {
  data(){
    return{
      value:''
    }
  },
  //父传子
  props:['msg'],
  methods:{
   btn(){
     //传值给元素
     this.$emit('sendson',this.value)
   }
  }
 
}
</script>
<style scoped lang="scss">
 .son{
>p{
  background-color: blue;
  color: #fff;
  margin: 10px auto;

  height: 100px;
  text-align: center;
  line-height: 100px;
}
 }
</style>